package shake.event;

import java.lang.reflect.ParameterizedType;

import shake.Event;

import com.google.inject.Injector;

public class EventImpl<T> implements Event<T> {
	Injector injector;
	ParameterizedType type;

	public EventImpl(ParameterizedType type, Injector injector) {
		this.type = type;
		this.injector = injector;
	}

	public void fireEvent(Object... param) {
		EventInvoker manager = injector.getInstance(EventInvoker.class);
		manager.invoke(injector, type, null, param);
	}

	public void fireNamedEvent(String name, Object... param) {
		EventInvoker manager = injector.getInstance(EventInvoker.class);
		manager.invoke(injector, type, name, param);
	}
}
